const install = (Vue) => {
  /**
   * 加载进度框
   * @param {String} title 提示文字
   * @param {Boolean}} mask = [true | false] 是否显示遮罩层
   * @param {Number} duration = 3000 多久后关闭
   */
  Vue.prototype.$loading = (title = '加载中...', mask = false, duration = 10000) => {
    uni.showLoading({
      title,
      mask
    })
    let timer = setTimeout(() => {
      uni.hideLoading()
      clearTimeout(timer)
    }, duration)
  }

  Vue.prototype.$hideLoading = () => {
    uni.hideLoading()
  }
}

export default {
  install
}